<template>
  <div class="flex h-[80vh] flex-col py-2">
    <h2 class="mb-2 px-1 text-xl font-bold text-zinc-900 dark:text-zinc-200">
      所有分类
    </h2>
    <ul class="overflow-y-scroll">
      <li
        v-for="category in categories"
        :key="category.id"
        class="px-1 py-1.5 text-lg text-zinc-900 duration-100 active:bg-zinc-100 dark:text-zinc-300 dark:active:bg-zinc-900"
        :class="{}"
        @click="$emit('onItemClick', category)"
      >
        {{ category.name }}
      </li>
    </ul>
  </div>
</template>

<script setup lang="ts">
import type { Category } from '@/views/main/components/types';

const { categories } = defineProps<{
  categories: Category[];
}>();

defineEmits<{
  onItemClick: [category: Category];
}>();
</script>
